package proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Created by luzl on 4/8/2017.
 */
public class DynamicAgent implements InvocationHandler{

    public Object obj;

    public DynamicAgent(Object obj){
        this.obj=obj;
    }
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("Sell start in dynamic agent!");
        Object result=method.invoke(obj,args);
        System.out.println("Sell completed in dynamic agent!");
        return result;
    }
}
